<%@page language="java" import="com.scalar.chiptrack.finance.purchaseorder.ReceivingsTransaction,
                                com.scalar.chiptrack.utils.StringUtils,
                                java.util.Iterator,
                                java.util.HashMap,
                                com.scalar.chiptrack.users.Functionality,
                                com.scalar.chiptrack.users.User,
                                java.util.ArrayList,
                                com.scalar.chiptrack.finance.purchaseorder.forms.ReceivingsTransactionForm,
                                com.scalar.chiptrack.finance.purchaseorder.ReceivingsTransactionLineItem,
                                com.scalar.chiptrack.finance.purchaseorder.ReceivingsTransactionLineItemList" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<% int i = 0; /*variable used to assign numers to marketing part number drop down*/%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html:html>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<chiptrack:checkLogon sourcePage="/jsp/finance/auto_receving_and_invoice_entry.jsp"/>

<META http-equiv='Content-Type' content='text/html; charset=windows-1252'>
<LINK href='<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css' type='text/css' rel='stylesheet'>

<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</SCRIPT>

<SCRIPT language='JavaScript'>

function reset()
{
    document.receivingsTransactionForm.reset();
    disableShipmentFieldsOnLoad();
}

function enableFields()
{
    // This function Enables all the Fields before Submitting the page.
    var form = document.receivingsTransactionForm;
    var count = document.receivingsTransactionForm.count.value;

    form['receivingsTransaction.receiptNumber'].disabled=false;
    form['receivingsTransaction.subTotal'].disabled = false;
    form['receivingsTransaction.tradeDiscount'].disabled = false;
    form['receivingsTransaction.freight'].disabled = false;
    form['receivingsTransaction.miscellaneous'].disabled = false;
    form['receivingsTransaction.tax'].disabled = false;
    form['receivingsTransaction.total'].disabled = false;


    for( i = 0; i < count; i++ )
    {
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].poNumber'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].manufacturingPartNo'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].marketingPartNo'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].lineItemDescription'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityShipped'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityInvoiced'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityOrdered'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].unitCost'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].extendedCost'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].previousShipped'].disabled = false;
        form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].previousInvoiced'].disabled = false;
    }
}

// This Function is Called when the user clicks on Save Link.
function saveAutoReceivings()
{
    var docNumber;
    var form = document.receivingsTransactionForm;
    // If user edits the Receivings then take the old vendor document no.
    if( form.oldVendorDocNumber != null )
    {
        docNumber = form.oldVendorDocNumber.value;
    }

	var paPo = document.getElementById("lineItemErrors");
    paPo.innerHTML = "";

    if ( parseFloat( form['receivingsTransaction.subTotal'].value ) > 99999999999999.99 )
    {
        paPo.innerHTML = " <li> Sub Total cannot be greater than 99999999999999.99";
        return;
    }
    if ( parseFloat( form['receivingsTransaction.tradeDiscount'].value ) > 999999999999.99 )
    {
        paPo.innerHTML = " <li> Trade Discount cannot be greater than 999999999999.99";
        return;
    }

    if ( parseFloat( form['receivingsTransaction.freight'].value ) > 999999999999.99 )
    {
        paPo.innerHTML = " <li> Freight cannot be greater than 999999999999.99";
        return;
    }

    if ( parseFloat( form['receivingsTransaction.miscellaneous'].value ) > 999999999999.99 )
    {
        paPo.innerHTML = " <li> Miscellaneous cannot be greater than 999999999999.99";
        return;
    }

    if ( parseFloat( form['receivingsTransaction.tax'].value ) > 999999999999.99 )
    {
        paPo.innerHTML = " <li> Tax cannot be greater than 999999999999.99";
        return;
    }

    calculateTotal(); // To calculate Totals.

    if ( checkBeforeSubmit() == false )
    {
        return;
    }
    else
    {
        document.receivingsTransactionForm.action.value='confirm';
        document.receivingsTransactionForm.saveOrPost.value='save';
        document.receivingsTransactionForm.docNo.value=docNumber;

        var totalLineItems = form.count.value;
        var isLineItemSaved = 'false';
        var isLineItemExist = 'flase';

        for( k = 0; k < totalLineItems; k ++ )
        {
            if( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].lineItemSave'] != null )
            {
                isLineItemExist = 'true';
                if( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].disableCheckBox'].value == 'true' )
                {
                    form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].lineItemSave'].checked = true;
                 }
                 form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].lineItemSave'].disabled = false;

                //For checking if Line items are selected before saving.
                if( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].lineItemSave'].checked == true )
                {
                    isLineItemSaved = 'true';
                }

                if( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].lineItemSave'].checked == true )
                {
                    if( parseInt( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].quantityShipped'].value ) <= 0 )
                    {
                        paPo.innerHTML = " <li> Shipped Quantity should be greater than zero in Line Item No" + parseInt(k + 1);
                        return;
                    }
                }

            }
        }

        //To check if Line items are selected before saving.
        if( isLineItemSaved == 'false' )
        {
            if( isLineItemExist == 'true' )
            {
                paPo.innerHTML = " <li> Select any Line Item to Generate an Auto Invoice.";
                return;
            }
            else
            {
                paPo.innerHTML = " <li> Auto Invoice cannot be Generated as Line Items does not Exist.";
                return;
            }
        }
        enableFields(); // To enable all disabled fields.
        document.receivingsTransactionForm.submit();
    }
}


function changeExtendedCost()
{
    //This function Calculates the Unit cost if Extended cost amount is changed.

    var form = document.receivingsTransactionForm;
    var count = document.receivingsTransactionForm.count.value;

    var unitCost;
    var quantityShipped;
    var quantityInvoiced;
    var extendedCost;

    for( i=0; i< count; i++ )
    {
        unitCost =  form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].unitCost'].value;

        quantityInvoiced = form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityInvoiced'].value;

        extendedCost = form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].extendedCost'].value;

        if( ( extendedCost == '0' ) || ( extendedCost == '' ) || ( quantityInvoiced == '0' ) || ( quantityInvoiced == '' ) || ( quantityInvoiced == '0.00' ) )
        {
            form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].extendedCost'].value = parseDec( round( ( parseFloat( parseFloat( quantityInvoiced ) * parseFloat( unitCost ) ) ) ), 2, '.' );
        }
        else if ( ( extendedCost != '0' ) && ( quantityInvoiced != '0' )  &&  ( unitCost != '0' )  )
        {
            if( ( parseFloat( extendedCost) / parseFloat( quantityInvoiced ) ) != parseFloat( unitCost ) )
            {
                form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].unitCost'].value = parseDec( round( parseFloat( ( parseFloat( extendedCost ) / parseFloat( quantityInvoiced ) ) ) ), 2, '.' );
            }
        }
    }
}

//This Function calculates the Totals for all the Fields.
function calculateTotal()
{
	var form = document.receivingsTransactionForm;
    var count = document.receivingsTransactionForm.count.value;
    var quantityShipped = 0;
    var unitCost = 0.00;
    var extendedCost = 0.00;
    var subTotal = 0.00;
    var total = 0.00;
    var poSubTotal = 0.00;

    var pa = document.getElementById("lineItemErrors");
    pa.innerHTML = '';

    // Loop Till the End Of Line Items
    for( i=0; i < count; i++ )
    {
        if ( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].lineItemSave'].checked == true )
        {
            if ( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].unitCost'].value == '' )
            {
                form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].unitCost'].value = '0.00';
            }

            if ( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityShipped'].value == '' )
            {
                form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityShipped'].value = '0';
            }

            if (  form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityInvoiced'].value == '' )
            {
                form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityInvoiced'].value = '0';
            }

            unitCost =  form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].unitCost'].value;
            quantityShipped = form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityShipped'].value;

            if ( unitCost > 99999999999999.99 )
            {
                form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].unitCost'].value = 99999999999999.99;
                pa.innerHTML = "<li> Unit Cost can not be more than 99999999999999.99";
            }

            extendedCost = parseDec( round( parseFloat( parseFloat( quantityShipped ) * parseFloat ( unitCost ) ) ), 2, '.' );

            if ( extendedCost > 99999999999999.99 )
            {
                form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].extendedCost'].value = 99999999999999.99;
            }
            else
            {
                form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].extendedCost'].value = extendedCost;
            }

            if( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].lineItemSave'] != null && ( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].lineItemSave'].checked == true || form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].disableCheckBox'].value == 'true' ) )
            {
                subTotal = parseDec( round( ( parseFloat( subTotal ) + parseFloat( extendedCost ) ) ), 2, '.' );
            }
        }
    }

    if ( subTotal > 99999999999999.99 )
    {
        form['receivingsTransaction.subTotal'].value = 99999999999999.99;
    }
    else
    {
        form['receivingsTransaction.subTotal'].value = subTotal;
    }

	if ( form['receivingsTransaction.freight'].value == '')
	{
		form['receivingsTransaction.freight'].value = '0.00';
	}
    else
    {
        form['receivingsTransaction.freight'].value =  parseMoney ( form['receivingsTransaction.freight'].value );
    }

	if ( form['receivingsTransaction.miscellaneous'].value == '' )
	{
		form['receivingsTransaction.miscellaneous'].value = '0.00';
	}
    else
    {
        form['receivingsTransaction.miscellaneous'].value =  parseMoney ( form['receivingsTransaction.miscellaneous'].value );
    }

	if ( form['receivingsTransaction.tax'].value == '' )
	{
		form['receivingsTransaction.tax'].value = '0.00';
	}
    else
    {
        form['receivingsTransaction.tax'].value =  parseMoney ( form['receivingsTransaction.tax'].value );
    }

	if ( form['receivingsTransaction.tradeDiscount'].value == '' )
	{
		form['receivingsTransaction.tradeDiscount'].value = '0.00';
	}
    else
    {
        form['receivingsTransaction.tradeDiscount'].value =  parseMoney ( form['receivingsTransaction.tradeDiscount'].value );
    }

    total = ( parseFloat( form['receivingsTransaction.freight'].value ) + parseFloat( form['receivingsTransaction.miscellaneous'].value ) + parseFloat( form['receivingsTransaction.tax'].value ) - parseFloat( form['receivingsTransaction.tradeDiscount'].value ) )+ parseFloat( subTotal ) ;

    if( total > 99999999999999.99  )
    {
        form['receivingsTransaction.total'].value = 99999999999999.99;
    }
    else
    {
        form['receivingsTransaction.total'].value = parseDec( round( parseFloat( ( parseFloat( total ) ) ) ), 2, '.' );
    }

}

/*
function receivingsTaxScheduleEntry()
{
    if( document.receivingsTransactionForm['receivingsTransaction.receiptTypeId'].value == '1' )
    {
        //do nothing.
    }
    else
    {
        newWindow = window.open ('<%=chipTracContext%>/autoReceivingAndInvoice.do?action=receivingsTransactionTaxScheduleEntry','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=no,width=500,height=270,resizable=no');
        newWindow.focus();
    }
}
*/

//This function is called when the Page loads.
function disableShipmentFieldsOnLoad()
{
    var form = document.receivingsTransactionForm;
    var count = document.receivingsTransactionForm.count.value;
    var paLineItem = document.getElementById("lineItemErrors");

    paLineItem.innerHTML = "";
    var qtyReceived = 0;
    var qtyOrdered  = 0;
    var checkQuantity = "";
    var removeComma = "";

    var totalLineItems = form.count.value;


    for( k = 0; k < totalLineItems; k++ )
    {

        if ( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].extendedCost'].value <= 99999999999999.99 )
        {
            form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].extendedCost'].value = parseDec( round( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].extendedCost'].value ), 2, '.' );
        }
        else
        {
            form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].extendedCost'].value = 99999999999999.99;
        }

         // Added for displayig a warning message to user if the Quantity Received is greater than Quantity Ordered.
         qtyReceived = parseDec( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].quantityShipped'].value, 0 );
         qtyOrdered  = parseDec( form['receivingsTransaction.receivingsTransactionLineItemList[' + k + '].quantityOrdered'].value, 0 );

         if( eval (qtyReceived) > eval(qtyOrdered) )
         {
            checkQuantity = checkQuantity + parseInt( k + 1 ) + ',  ';
         }
    }

    // Remove the Last character(,) from checkQuantity string.
    removeComma = checkQuantity.lastIndexOf(",");
    checkQuantity = checkQuantity.substring( 0, removeComma );

    if( checkQuantity != '' )
    {
        paLineItem.innerHTML = "<LI> Quantity Invoiced is more than Quantity Ordered in Line Item(s) " + checkQuantity;
    }

    if( form['receivingsTransaction.total'].value > 999999999999.99 )
    {
        form['receivingsTransaction.total'].value =  999999999999.99;
    }

}

// This Function is called when the User Selects the vendor From the List.
function vendorOnChange()
{
    document.receivingsTransactionForm['receivingsTransaction.receiptNumber'].disabled=false;
    document.receivingsTransactionForm.action.value='loadOrdersByVendor';
    document.receivingsTransactionForm['receivingsTransaction.vendorDocNumber'].focus();
    document.receivingsTransactionForm.submit();
}

// This function checks for Marketing Part No before submitting the page.
function checkBeforeSubmit()
{
    var form = document.receivingsTransactionForm;
    var count = form.count.value;
    var paReceivings = document.getElementById("receivingsErrors");
    var paLineItem = document.getElementById("lineItemErrors");
    var receiptDate = form['receivingsTransaction.receiptDate'].value;

    paReceivings.innerHTML = "";
    paLineItem.innerHTML = "";

    if( form['receivingsTransaction.vendorId'].value == '' )
    {
        paReceivings.innerHTML = " <li> Please Select Vendor ID";
        return false;
    }
    if( form['receivingsTransaction.vendorDocNumber'].value == '' )
    {
        paReceivings.innerHTML = " <li> Reference No should be entered";
        form['receivingsTransaction.vendorDocNumber'].focus();
        return false;
    }

    if( ( parseFloat( form['receivingsTransaction.tradeDiscount'].value) ) > ( parseFloat( form['receivingsTransaction.subTotal'].value ) ) )
    {
        paReceivings.innerHTML = " <li> Enter a Smaller Trade Discount. The Trade Discount must be less than the Sub Total minus the Total for Canceled Items";
        return false;
    }
    if( !chkDate( receiptDate, "Receipt Date", 'Y' ) )
    {
        paReceivings.innerHTML = " <li> Please Enter Date in MM/DD/YYYY format ";
        return false;
    }

    for( i = 0; i < count; i++ )
    {
        if( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].poNumber'].value == '' )
        {
            paLineItem.innerHTML = " <li> Please Select Purchase Order Number in Line Item No " + parseInt(i + 1);
            return false;
        }
        else if( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].manufacturingPartNo'].value == '' )
        {
            paLineItem.innerHTML = " <li> Please enter Manufacturing Part Number in Line Item No " + parseInt(i + 1);
            return false;
        }
        else if( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].lineItemDescription'].value.length > '50' )
        {
            paLineItem.innerHTML = " <li> Description cannot be more than 50 in Line Item No " + parseInt(i + 1);
            return false;
        }
        else if( parseInt( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityInvoiced'].value ) > parseInt( form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].quantityShipped'].value ) )
        {
            paLineItem.innerHTML = " <li> Invoiced Quantity cannot be Greater than Shipped Quantity in Line Item No" + parseInt(i + 1);
            return false;
        }
    }
}

function onCheckBoxChange( rowNo )
{
    var paLineItem = document.getElementById("lineItemErrors");
    paLineItem.innerHTML = "";
    var form = document.receivingsTransactionForm;
    var noOfLineItems = form.count.value;

    if( form['receivingsTransaction.receivingsTransactionLineItemList[' + rowNo + '].lineItemSave'].checked == true )
    {
        if( form['receivingsTransaction.vendorId'].value == '' )
        {
            paLineItem.innerHTML = "<li> Please Select Vendor ID to Load Line Items.";
            form['receivingsTransaction.receivingsTransactionLineItemList[' + rowNo + '].lineItemSave'].checked = false;
        }
    }

    if( form['receivingsTransaction.vendorId'].value != '' )
    {
        calculateTotal();
    }
}

function convertToUpperCase()
{
    var tempDocNo = '';
    var textToConvert = document.receivingsTransactionForm['receivingsTransaction.vendorDocNumber'].value;
    var docNoLength = textToConvert.length;

    if( textToConvert != '' )
    {
        for( i=0; i <= textToConvert.length ; i++ )
        {
            tempDocNo = tempDocNo + textToConvert.charAt(i).toUpperCase();
        }
        document.receivingsTransactionForm['receivingsTransaction.vendorDocNumber'].value = tempDocNo;
    }
    document.receivingsTransactionForm['receivingsTransaction.vendorDocNumber'].focus;
}

function purchasingLotNumberEntry(i)
{
    var form = document.receivingsTransactionForm;
    var queryString = "<%=chipTracContext%>/autoReceivingAndInvoice.do?action=purchasingLotNumberEntry";
    queryString = queryString + "&receiptIndex=" + form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].receiptIndex'].value;
    queryString = queryString + "&receivingsTransactionLineItemSequenceNo=" + form['receivingsTransaction.receivingsTransactionLineItemList[' + i + '].receivingsTransactionLineItemSequenceNo'].value;

    newWindow = window.open ( queryString,'optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=750,height=380,left=150,top=100,resizable=yes' );
    newWindow.focus();
}

function editPurchasingLotNumberEntry(i)
{
    var form = document.receivingsTransactionForm;
    var paLineItem = document.getElementById("lineItemErrors");
    paLineItem.innerHTML = "";

	var poNumber		= form['receivingsTransaction.receivingsTransactionLineItemList['+ i + '].poNumber'].value;
	var vendorNumber	= form['receivingsTransaction.vendorId'].value;
	var itemNumber		= form['receivingsTransaction.receivingsTransactionLineItemList['+ i + '].manufacturingPartNo'].value;
	var poSeqNumber		= form['receivingsTransaction.receivingsTransactionLineItemList['+ i + '].poLineItemSequenceNo'].value;
	var qtyOrdered		= eval( form['receivingsTransaction.receivingsTransactionLineItemList['+ i + '].quantityOrdered'].value );
	var qtyCancelled	= eval( form['receivingsTransaction.receivingsTransactionLineItemList['+ i + '].quantityCancelled'].value );
	var qtyPrevShipped	= eval( form['receivingsTransaction.receivingsTransactionLineItemList['+ i + '].previousShipped'].value );
	var maxQtyToPull	= ( parseInt( qtyOrdered ) - parseInt( qtyCancelled ) - parseInt ( qtyPrevShipped ) );

	if( form['receivingsTransaction.receivingsTransactionLineItemList['+ i + '].lineItemSave'].checked == true )
	{
		var queryString = "<%=chipTracContext%>/purchaseOrderLotAction.do?action=poLots&poNumber="+ poNumber +"&vendorNumber="+ vendorNumber +"&itemNumber="+ itemNumber +"&poSeqNumber=" + poSeqNumber + "&maxQty="+ maxQtyToPull+"&rowIndex="+ i;
		newWindow = window.open ( queryString, 'optionsPopup', 'channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=750,height=380,left=150,top=100,resizable=yes' );
		newWindow.focus();
	}
	else
	{
		paLineItem.innerHTML = "Please select the check box to Allocate Lots";
	}
}

function loadPurchasingLotNumberEntry(poNumber,poSeqNumber,i)
{
    var form = document.receivingsTransactionForm;
    var paLineItem = document.getElementById("lineItemErrors");
    paLineItem.innerHTML = "";

	if( form['receivingsTransaction.receivingsTransactionLineItemList['+ i + '].lineItemSave'].checked == true )
	{
        var vendorNumber	= form['receivingsTransaction.vendorId'].value;
		var queryString = "<%=chipTracContext%>/purchaseOrderLotAction.do?action=poLotsModify&poNumber="+ poNumber +"&poSeqNumber=" + poSeqNumber +"&vendorNumber="+ vendorNumber;
		newWindow = window.open ( queryString, 'optionsPopup', 'channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=750,height=380,left=150,top=100,resizable=yes' );
		newWindow.focus();
	}
	else
	{
		paLineItem.innerHTML = "Please select the check box to Allocate Lots";
	}
}

function setQuantityPulled( totalPulledQty, rowIndex )
{
    var form = document.receivingsTransactionForm;
	form['receivingsTransaction.receivingsTransactionLineItemList['+ rowIndex + '].quantityShipped'].value = totalPulledQty;
	form['receivingsTransaction.receivingsTransactionLineItemList['+ rowIndex + '].quantityInvoiced'].value = totalPulledQty;
}

</SCRIPT>
</HEAD>
<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0' onload = "javascript:disableShipmentFieldsOnLoad();">
<!-- Top Header Start-->

<%@include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<p>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@include file="/jsp/finance/purchase_order_menu.jsp" %>
</TD>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<!-- SiteMap Tag >
< c h i p t r a c k : s i t e m a p   s t y l e C l a s s = " N A r i a l S " / -->

<chiptrack:permission functionality='<%=Functionality.RECEIVINGS_TRANSACTION%>'
    action='<%=User.USER_ACTION_MODIFY%>' styleClass="NArialL" >
</chiptrack:permission>

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->
			<P>

			<TABLE BORDER="0" WIDTH="100%">

				<TR>
					<TD WIDTH="100%">
            <html:form name="receivingsTransactionForm" action="/autoReceivingAndInvoice.do" method="post" type="com.scalar.chiptrack.finance.purchaseorder.forms.ReceivingsTransactionForm">
            <input type= "hidden" name = "action" value="">
            <input type= "hidden" name = "saveOrPost" value="">
            <input type= "hidden" name = "docNo" value="">

            <TABLE BORDER="0" WIDTH="100%" HEIGHT="175%">
				<TR>
					<TD WIDTH="100%">
						<TABLE BORDER="0" WIDTH="100%">
							<TR>
								<TD WIDTH="60%" class="NArialW">
									<P ALIGN="CENTER">Auto Receipt
                                </TD>
                                <TD WIDTH="40%">&nbsp;</TD>
							</TR>
                            <TR>
                               <TD WIDTH="100%" colspan="2">&nbsp;</TD>
                            </TR>
                            <TR>
                               <TD colspan="2"><chiptrack:info styleClass="NArialL" /></TD>
                            </TR>
                            <TR>
                               <TD colspan="2"><chiptrack:errors styleClass="NArialL" /></TD>
                            </TR>
                            <TR>
                               <TD colspan="2"><chiptrack:moreErrorInfo styleClass="NArialL" /></TD>
                            </TR>
						</TABLE>
                        <BR>
						<BR>
                        <nested:nest property="receivingsTransaction">

						<TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
                            <TR>
                                <TD WIDTH = "100%" COLSPAN="9">
                                    <FONT id="receivingsErrors" styleClass="NArialL" color="red" size="1"></FONT>
                                </TD>
                            </TR>
							<TR>
								<TD WIDTH="3%">&nbsp;</TD>
								<TD WIDTH="9%">Receipt Number:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="10%">
                                    <nested:text property="receiptNumber" styleClass="txfield" size="21" maxlength="17" disabled="true" readonly="true"/>
                                    <nested:define property="receiptNumber" id="receiptNumberString" />
                                </TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="6%">Type:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="34%">Shipment/Invoice
                                </TD>
                        		<TD WIDTH="11%">&nbsp;</TD>
							</TR>
							<TR>
								<TD WIDTH="3%">&nbsp;</TD>
								<!--TD WIDTH="9%">Vendor No:&nbsp;<font color ="red" style="arial">*</font></TD-->
                                <TD WIDTH="9%">Reference No:&nbsp;<font color ="red" style="arial">*</font></TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="10%">

                                    <nested:text property="vendorDocNumber" styleClass="txfield" size="21" maxlength="21" onblur="javascript:convertToUpperCase();"/>
                                    <logic:equal name="action" value="edit" >
                                        <input type="hidden" name = "oldVendorDocNumber" value="<nested:write property="originalVendorDocNumber"/>"/>
                                    </logic:equal>
                                    <nested:hidden property="reference"/>
								</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="8%">Receipt Date:&nbsp;<font color ="red" style="arial">*</font></TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="34%">
									<nested:text property="receiptDate" styleClass="txField" size="11" maxlength="10"/>
								</TD>
								<TD WIDTH="11%">&nbsp;</TD>
							</TR>
                            <TR>
								<TD WIDTH="3%">&nbsp;</TD>
								<TD WIDTH="9%">Vendor Name:&nbsp;<FONT color="red" style="arial">*</FONT></TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="10%">
                                    <logic:equal name="action" value="edit">
                                        <nested:text property="vendorName" disabled="true" readonly="true" styleClass="txfield" />
                                        <nested:hidden property="vendorId" />
                                    </logic:equal>

                                    <logic:notEqual name="action" value="edit" >
                                        <nested:select property="vendorId" styleClass="txfield" onchange="javascript:vendorOnChange()" >
                                            <html:options collection = "vendorsList" property="label" labelProperty="value"/>
                                        </nested:select>
                                    </logic:notEqual>
                                    <!--nested:text property="vendorDocNumber" styleClass="txfield" size="21" maxlength="21" />
                                    <!--logic:equal name="action" value="edit" >
                                        <input type="hidden" name = "oldVendorDocNumber" value="<!--nested:write property="originalVendorDocNumber"/>"/>
                                    <!--/logic:equal>
                                    <!--nested:hidden property="reference"/-->
                                </TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="8%">&nbsp;</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="34%">&nbsp;</TD>
								<TD WIDTH="11%">&nbsp;</TD>
							</TR>

						</TABLE>
                        <BR>
						<BR>
                        <TABLE BORDER="0" WIDTH="100%" CLASS="NArialL">
                           <TR>
                                <TD WIDTH = "100%" COLSPAN="13">
                                  <!-- <font class="NArialS" color='blue'>
                                  <b> <IMG SRC="<%=chipTracContext%>/jsp/includes/images/exclamation-46x47.gif" BORDER="0" HEIGHT="20" WIDTH="20" ALIGN="BOTTOM">
                                  Line Items Do Not Exist For PO Number
                                  </font> -->
                                <!--PO Number : <!--nested:select property="selectedPONumber" styleClass="txfield">
                                           <!--html:options collection = "poNumberList" property="label" labelProperty="value" />
                                       <!--/nested:select>&nbsp;&nbsp;&nbsp;&nbsp;
                                    <!--chiptrack:restrictedLink functionality="<%//=Functionality.RECEIVINGS_TRANSACTION%>"
                                      action="<%//=User.USER_ACTION_MODIFY%>"href="javascript:POOnChange()" onmouseover="window.status='Click here To add a new Line Item';return true" onmouseout="window.status='';return true">
                                      <IMG SRC="<%//=chipTracContext%>/jsp/includes/images/addmore.gif" ALIGN="BOTTOM" BORDER="0" >
                                    <!--/chiptrack:restrictedLink-->
                                </TD>
                            </TR>
                            <TR>
                                <TD WIDTH = "100%" COLSPAN="13">
                                    <FONT id="lineItemErrors" styleClass="NArialL" color="red" size="1"></FONT>
                                </TD>
                            </TR>
							<TR>
								<TD WIDTH="4%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER">&nbsp;<FONT COLOR="white">S.No</FONT>
								</TD>
                                <TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">PO Number</FONT>
								</TD>
								<TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Part Number</FONT>
								</TD>
								<TD WIDTH="10%" HEIGHT="26" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Vendor Part Number</FONT>
								</TD>
                                <TD WIDTH="16%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Description</FONT>
								</TD>
                                <!--TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Site</FONT>
								</TD-->
								<TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Quantity Shipped</FONT>
								</TD>
								<TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Quantity Ordered</FONT>
								</TD>
								<TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Quantity Cancelled</FONT>
								</TD>
                                <TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Quantity Invoiced</FONT>
								</TD>
								<TD WIDTH="10%" HEIGHT="16" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Unit Cost</FONT>
								</TD>
								<TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Extended Cost</FONT>
								</TD>
                                <TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Previous Shipped</FONT>
								</TD>
                                <TD WIDTH="10%" HEIGHT="26" ALIGN="CENTER" BGCOLOR="#993333">
									<P ALIGN="CENTER"><FONT COLOR="white">Previous Invoiced</FONT>
								</TD>
							</TR>
                            <nested:iterate id = "ReceivingsTransactionLineItem" property="receivingsTransactionLineItemList" type="com.scalar.chiptrack.finance.purchaseorder.ReceivingsTransactionLineItem" >
							<TR>
								<TD WIDTH="4%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<P ALIGN="CENTER">&nbsp;
                                    <nested:hidden property="rowId"/>
                                    <nested:write property="receiptIndex" />
                                    <nested:hidden property="receiptIndex" />

                                    <nested:hidden property="poLineItemSequenceNo"/>

                                    <nested:hidden property="receivingsTransactionLineItemSequenceNo"/>

                                    <!-- Hidden field stores the no of Line items available for a Purchase Order -->
                                    <nested:hidden property="lineItemCount" />
								</TD>
                                <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2" NOWRAP>
									<CENTER>
									<P>
                                    <bean:define id="index" value="0"/>
                                       <nested:hidden property="disableCheckBox" />
                                       <% String temp = "javascript:onCheckBoxChange(" + i + ")"; %>
                                       <% if( ReceivingsTransactionLineItem.getPoLineItemSequenceNo() == 0 && ReceivingsTransactionLineItem.getPoNumber().length() != 0 )
                                       {
                                       %>
                                          <IMG SRC="<%=chipTracContext%>/jsp/includes/images/exclamation-46x47.gif" BORDER="0" HEIGHT="20" WIDTH="20" ALIGN="LEFT" ALT="No Purchase Order exists for this Line Item." >
                                       <%
                                       }
                                       else
                                       {
                                       %>
                                          <nested:checkbox property="lineItemSave" styleClass="txfield" onclick ="<%=temp%>"/>
                                       <%
                                       }
                                       %>
                                      <nested:text property="poNumber" readonly="true" disabled="true" styleClass="txfield" size="21"/>
                                    </CENTER>
								</TD>
								<TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2" nowrap>
									<CENTER>
									<P>
                                    <nested:hidden property="manufacturingPartNoLabel" />
                                    <nested:text property="manufacturingPartNo" readonly="true" disabled="true" styleClass="txfield"/>

                                    <!--nested:select property="manufacturingPartNo" styleClass="txfield" onchange="javascript:itemOnChange( this );">
                                        <option value="">---- Select ----</option>
                                        <!-- This list stores the Manufacturing part nos list have to change name later.-->
                                        <!--html:options collection = "marketingPartNoList" property="value" labelProperty="label" />
                                    <!--/nested:select-->

                                    </CENTER>
								</TD>
<!-- 		                        <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
								 < % temp = "javascript:editPurchasingLotNumberEntry(" + i + ")"; % >
									<P ALIGN="CENTER"><a href="<%=temp%>" onmouseover="window.status='Click To add Purchasing Lot Number Entry Details';return true" onmouseout="window.status='';return true">link<a>
								</TD> -->
								<TD WIDTH="10%" BGCOLOR="#DEE1E2" nowrap>
									<CENTER>
									<P>
                                    <nested:text property="marketingPartNo" styleClass="txfield" maxlength="31" disabled="true"/>
                                    </CENTER>
                                    </CENTER>
								</TD>
                                <TD WIDTH="16%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:textarea property="lineItemDescription" styleClass="txField" disabled="true"/>
                                    </CENTER>
								</TD>
                                <!--TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P>
                                    <!--nested:hidden property="siteIdLabel" value="" />

                                        <!--nested:select property="siteId" styleClass="txfield" >
                                            <!--html:options collection = "siteList" property="value" labelProperty="label"  />
                                        <!--/nested:select>

                                    </CENTER>
								</TD-->
								<!-- added onkeypress for quantityShipped, quantityInvoiced etc. fields: Phani  -->
                                <TD WIDTH="10%" ALIGN="LEFT" BGCOLOR="#DEE1E2" nowrap>

									<P><nested:text property="quantityShipped" styleClass="valuetxfield" size="11" onblur="javascript:calculateTotal()" maxlength="9" onkeypress="javascript:amountFieldKeyPress( this )" disabled="true"/>

                                    <logic:equal name="action" value="edit">
                                        <a href="javascript:loadPurchasingLotNumberEntry('<bean:write name="receiptNumberString" />','<nested:write property="receivingsTransactionLineItemSequenceNo"/>','<%=i%>')" onmouseover="window.status='Click To add Purchasing Lot Number Entry Details';return true" onmouseout="window.status='';return true">Allocate<a>
                                    </logic:equal>
                                    <logic:notEqual name="action" value="edit">
                                        <% temp = "javascript:editPurchasingLotNumberEntry(" + i + ")"; %>
                                        <a href="<%=temp%>" onmouseover="window.status='Click To add Purchasing Lot Number Entry Details';return true" onmouseout="window.status='';return true">Allocate<a>
                                    </logic:notEqual>
                            <%--Commented by Krishn Prasad 29-09-04
                            <logic:notEqual name="action" value="edit">
                            <% //if( ReceivingsTransactionLineItem.getQuantityShipped() + ReceivingsTransactionLineItem.getPreviousShipped() == ReceivingsTransactionLineItem.getQuantityOrdered() )
                                //{
                                  //   temp = "javascript:purchasingLotNumberEntry(" + i + ")";
							%>
                                     <!-- <a href="<%=temp%>" onmouseover="window.status='Click To view Purchasing Lot Number Details';return true" onmouseout="window.status='';return true">View</a> -->
							<%
                                //}
                                //else
                                //{
									 temp = "javascript:editPurchasingLotNumberEntry(" + i + ")";
							%>
									 <a href="<%=temp%>" onmouseover="window.status='Click To add Purchasing Lot Number Entry Details';return true" onmouseout="window.status='';return true">Allocate<a>
							<%
                              //  }
							%>--%>
							<%--</logic:notEqual>--%>
								</TD>
                                <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:text property="quantityOrdered" styleClass="valuetxfield" size="11" onblur="javascript:calculateTotal()" disabled="true" maxlength="9" />
                                    </CENTER>
								</TD>
                                <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:text property="quantityCancelled" styleClass="valuetxfield" size="11" disabled="true" maxlength="9" />
                                    </CENTER>
								</TD>
								<TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:text property="quantityInvoiced" styleClass="valuetxfield" size="11" onblur="javascript:calculateTotal()" maxlength="9" onkeypress="javascript:amountFieldKeyPress( this )" disabled="true"/>
                                    </CENTER>
								</TD>
								<TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:text property="unitCost" styleClass="valuetxfield" maxlength="15" size="24" onblur="javascript:calculateTotal()"  onkeypress="javascript:amountFieldKeyPress( this )" disabled="true"/>
                                    </CENTER>
								</TD>
								<TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:text property="extendedCost" styleClass="valuetxfield" maxlength="17" size="24" onchange="javascript:changeExtendedCost();"  onkeypress="javascript:amountFieldKeyPress( this )" disabled="true"/>
                                    </CENTER>
								</TD>
                                <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:text property="previousShipped" styleClass="valuetxfield" size="11" onchange="javascript:changeExtendedCost();" disabled="true" />
                                    </CENTER>
								</TD>
                                <TD WIDTH="10%" ALIGN="CENTER" BGCOLOR="#DEE1E2">
									<CENTER>
									<P><nested:text property="previousInvoiced" styleClass="valuetxfield" size="11" onchange="javascript:changeExtendedCost();" disabled="true" />
                                    </CENTER>
								</TD>
							</TR>
                            <% i++;%>
                            </nested:iterate>
                            <TR>
                                <TD COLSPAN="10" WIDTH="70%">

								</TD>
								<TD WIDTH="10%">

								</TD>
                                <TD WIDTH="10%" >

								</TD>
                                <TD WIDTH="10%" >

								</TD>
							</TR>
                            <TR>
								<TD COLSPAN="10" WIDTH="80%" ALIGN="RIGHT">&nbsp;</TD>
                                <TD WIDTH="10%">&nbsp;</TD>
                                <TD WIDTH="10%">&nbsp;</TD>
							</TR>
                            <TR>
								<TD COLSPAN="10" WIDTH="80%" ALIGN="RIGHT">Subtotal:</TD>
                                <TD WIDTH="10%"><nested:text property="subTotal" styleClass="valuetxfield" maxlength="17" size="24" disabled = "true"/></TD>
                                <TD WIDTH="10%">&nbsp;</TD>
							</TR>
                            <TR>
                                <TD COLSPAN="10" WIDTH="80%" ALIGN="RIGHT">Trade Discount:</TD>
                                <TD WIDTH="10%"><nested:text property="tradeDiscount" styleClass="valuetxfield" maxlength="15" size="24" onblur="javascript:calculateTotal()"  onkeypress="javascript:amountFieldKeyPress( this )"/></TD>
                                <TD WIDTH="10%">&nbsp;</TD>
							</TR>
                            <TR>
                                <TD COLSPAN="10" WIDTH="80%" ALIGN="RIGHT">Freight:</TD>
                                <TD WIDTH="10%"><nested:text property="freight" styleClass="valuetxfield" maxlength="15" size="24" onblur="javascript:calculateTotal()"  onkeypress="javascript:amountFieldKeyPress( this )"/>&nbsp;</TD>
                                <TD WIDTH="10%">&nbsp;</TD>
							</TR>
                            <TR>
                                <TD COLSPAN="10" WIDTH="80%" ALIGN="RIGHT">Miscellaneous:</TD>
                                <TD WIDTH="10%"><nested:text property="miscellaneous" styleClass="valuetxfield" maxlength="15" size="24" onblur="javascript:calculateTotal()"  onkeypress="javascript:amountFieldKeyPress( this )"/>&nbsp;</TD>
                                <TD WIDTH="10%">&nbsp;</TD>
							</TR>
                            <TR>
                                <TD COLSPAN="10" WIDTH="80%" ALIGN="RIGHT">Tax:</TD>
                                <TD WIDTH="10%"><nested:text property="tax" styleClass="valuetxfield" maxlength="15" size="24" onblur="javascript:calculateTotal()" onkeypress="javascript:amountFieldKeyPress( this )"/>&nbsp;</TD>
                                <TD WIDTH="10%">&nbsp;</TD>
							</TR>
                            <TR>
                                <TD COLSPAN="10" WIDTH="80%" ALIGN="RIGHT">Total:</TD>
                                <TD WIDTH="10%"><nested:text property="total" styleClass="valuetxfield" size="24"  disabled="true"/></TD>
                                <TD WIDTH="10%">&nbsp;</TD>
							</TR>
                             <TR>
								<TD COLSPAN="10" WIDTH="80%" ALIGN="RIGHT">&nbsp;</TD>
                                <TD WIDTH="10%">&nbsp;</TD>
                                <TD WIDTH="10%">&nbsp;</TD>
							</TR>
                        </TABLE>
						<BR>
						<BR>
					</TD>
				</TR>
			</TABLE>
           </nested:nest>
           <input type= "hidden" name = "count" value="<%=i%>">
           </html:form>

					</TD>
				</TR>
				<TR>
					<TD WIDTH="100%">
						<TABLE BORDER="0" WIDTH="100%">
							<TR>
								<TD WIDTH="40%"><P ALIGN="RIGHT">

                               <chiptrack:restrictedLink functionality="<%=Functionality.RECEIVINGS_TRANSACTION%>"
                                    action="<%=User.USER_ACTION_MODIFY%>"href="javascript:saveAutoReceivings();" onmouseover="window.status='Click here To Save Auto Receivings Transaction values';return true" onmouseout="window.status='';return true">
                                    <IMG SRC="<%=chipTracContext%>/jsp/includes/images/save.gif" ALIGN="BOTTOM" BORDER="0">
                                </chiptrack:restrictedLink>
                                </TD>
								<TD WIDTH="3%"><A href="autoReceivingAndInvoice.do" onmouseover="window.status='Click here To go back Auto Receivings Transaction Search menu';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/cancel.gif" ALIGN="BOTTOM" BORDER="0"></A></TD>
                                <TD width="40%"><A href="javascript:reset()" onmouseover="window.status='Click here to Reset';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/reset.gif" ALIGN="BOTTOM" BORDER="0"></A></TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
			</TABLE>
<!-- Your Work area ends here -->
		</TD>
		<TD BGCOLOR="white"><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="1" ALIGN="BOTTOM" BORDER="0"></TD>
	</TR>
</TBODY></TABLE>

<!-- Footer starts here -->

<%@include file="/jsp/includes/footer.jsp" %>

<!-- footer end here -->
</BODY>
</html:html>